package com.xudm.cdg.utils;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;


/**
 * @author Administrator
 */
public class RequestAttrUtil {
    public static RequestAttributes getRequestAttr() {
        return RequestContextHolder.currentRequestAttributes();
    }

    public static HttpServletResponse getHttpServletResponse() {
        return ((ServletRequestAttributes) getRequestAttr()).getResponse();
    }

    public static HttpServletRequest getHttpServletRequest() {
        return ((ServletRequestAttributes) getRequestAttr()).getRequest();
    }
}
